Skip to content

feat: add C implementation for stats/base/dists/lognormal/logcdf#10882

Open
rautelaKamal wants to merge 1 commit intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/lognormal/logcdf-c-port
Open

feat: add C implementation for stats/base/dists/lognormal/logcdf#10882
rautelaKamal wants to merge 1 commit intostdlib-js:developfrom
rautelaKamal:feat/stats/base/dists/lognormal/logcdf-c-port

Conversation

@rautelaKamal
Copy link
Copy Markdown
Contributor

Description

What is the purpose of this pull request?

This pull request:

  • Adds a C implementation for evaluating the natural logarithm of the cumulative distribution function (CDF) of a lognormal distribution (@stdlib/stats/base/dists/lognormal/logcdf). Following the pattern of the JS version, the C logic log-transforms the input x and elegantly delegates to the existing C implementation of @stdlib/stats/base/dists/normal/logcdf.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

AI Assistance Disclosure

  • Yes
  • No

If yes, how was AI used?
I used an AI coding assistant to help generate the C native addon boilerplate, manifest files, and safely mirror the JS test logic/R fixtures into the native test files. I manually reviewed all outputs and verified compilation.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review. labels Mar 11, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented Mar 11, 2026

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/lognormal/logcdf $\color{green}281/281$
$\color{green}+0.00%$
$\color{green}18/18$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{green}281/281$
$\color{green}+0.00%$

The above coverage report was generated for the changes in this PR.

@rautelaKamal rautelaKamal marked this pull request as draft March 12, 2026 00:41
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Mar 12, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch 3 times, most recently from 960fd26 to 36f518d Compare March 12, 2026 15:35
@rautelaKamal rautelaKamal marked this pull request as ready for review March 12, 2026 15:47
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 12, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch from 36f518d to 6ecc2de Compare April 1, 2026 11:21
@github-actions github-actions bot mentioned this pull request Apr 1, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch from 6ecc2de to e454f06 Compare April 4, 2026 07:48
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch from e454f06 to 14489bd Compare April 12, 2026 07:01
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rautelaKamal You need to revert many of the changes made to this file.

} else {
delta = abs( y - expected[ i ] );
tol = 1500.0 * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should go ahead and migrate to using isAlmostSameValue for ULP-based testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've migrated the tests to use isAlmostSameValue for ULP-based testing in the latest push. This PR should be ready for re-review.

@kgryte kgryte changed the title feat: add C implementation for @stdlib/stats/base/dists/lognormal/logcdf feat: add C implementation for stats/base/dists/lognormal/logcdf Apr 12, 2026
@kgryte kgryte added difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Needs Changes Pull request which needs changes before being merged. review: 3 and removed Needs Review A pull request which needs code review. labels Apr 12, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch from 14489bd to e705513 Compare April 13, 2026 07:06
@rautelaKamal rautelaKamal changed the title feat: add C implementation for stats/base/dists/lognormal/logcdf feat: add C implementation for stats/base/dists/lognormal/logcdf Apr 13, 2026
@rautelaKamal rautelaKamal force-pushed the feat/stats/base/dists/lognormal/logcdf-c-port branch from e705513 to 635e533 Compare April 13, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 2 May require some initial design or R&D, but should be straightforward to resolve and/or implement. Good First PR A pull request resolving a Good First Issue. Needs Changes Pull request which needs changes before being merged. review: 3 Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants